home *** CD-ROM | disk | FTP | other *** search
/ Mac Action 1996 January / mac-action-07.iso / mac / Inside Action / Total Distortion Big Demo / bePuzzl4.Dxr / 00002_Puzzle.script.ls < prev    next >
Encoding:
Text File  |  1995-06-05  |  2.0 KB  |  89 lines

  1. property peecStartChan, peecEndChan, SolveH, SolveV, TimeBarChan, TimeBarStartH, TimeCountN, TimeOutNum, TolerNum, SndCstStartNum
  2.  
  3. on birth me
  4.   global UEasy
  5.   if voidp(UEasy) then
  6.     set TolerNum to 5
  7.   else
  8.     set TolerNum to 9 - UEasy
  9.   end if
  10.   set TimeCountN to 0
  11.   set TimeOutNum to 112
  12.   set TimeBarChan to 41
  13.   set TimeBarStartH to 256
  14.   set peecStartChan to 5
  15.   set peecEndChan to 36
  16.   set SolveH to 256
  17.   set SolveV to 144
  18.   set SndCstStartNum to the number of cast "NotIn.snd"
  19.   go("puzzle1")
  20.   updateStage()
  21.   repeat with x = peecStartChan to peecEndChan
  22.     puppetSprite(x, 1)
  23.   end repeat
  24.   puppetSprite(TimeBarChan, 1)
  25.   return me
  26. end
  27.  
  28. on MasterTimer me
  29.   set TimeCountN to TimeCountN + 2
  30.   set the locH of sprite TimeBarChan to TimeBarStartH - (TimeCountN * 4)
  31.   if TimeCountN > (TimeOutNum - 1) then
  32.     cleanup(me)
  33.     go("TimesUp")
  34.   else
  35.     if TimeCountN > (TimeOutNum - (TimeOutNum / 2)) then
  36.       go("Puzzle2")
  37.     else
  38.       go(marker(0) + 1)
  39.       exit
  40.     end if
  41.   end if
  42. end
  43.  
  44. on cleanup me
  45.   puppetSprite(TimeBarChan, 0)
  46.   repeat with x = peecStartChan to peecEndChan
  47.     puppetSprite(x, 0)
  48.   end repeat
  49.   puppetSound(3, 0)
  50. end
  51.  
  52. on ExitPuzzle me
  53.   cleanup(me)
  54.   go("1")
  55. end
  56.  
  57. on PuzzlePeecDrag me, spritnum
  58. end
  59.  
  60. on PuzzlePeecDrop me, spritnum
  61.   set h to the locH of sprite spritnum
  62.   set v to the locV of sprite spritnum
  63.   if (h < (SolveH + TolerNum)) and (h > (SolveH - TolerNum)) then
  64.     if (v < (SolveV + TolerNum)) and (v > (SolveV - TolerNum)) then
  65.       set the locH of sprite spritnum to SolveH
  66.       set the locV of sprite spritnum to SolveV
  67.       puppetSound(3, SndCstStartNum + random(6))
  68.     end if
  69.   else
  70.     puppetSound(3, SndCstStartNum)
  71.     exit
  72.   end if
  73.   checkAllPieces()
  74. end
  75.  
  76. on checkAllPieces me
  77.   repeat with x = peecStartChan to peecEndChan
  78.     set h to the locH of sprite x
  79.     set v to the locV of sprite x
  80.     if (h = SolveH) and (v = SolveV) then
  81.       nothing()
  82.       next repeat
  83.     end if
  84.     exit
  85.   end repeat
  86.   cleanup(me)
  87.   go("PuzzleSolved")
  88. end
  89.